#include <iostream>
#include <vector>
#include <string>
using namespace std;

template<class T>
void Purge_Sq_OL(vector<T>& L)
{
	int l = 0, r = 1;
	while (r < L.size())
	{
		if (L[r] == L[l]) r++;
		else L[++l] = L[r++];
	}
	L.resize(l + 1);
}

template<class T>
void _Purge_Sq_OL(T a)
{
	vector<T> v;
	T tmp;
	while (cin >> tmp)
		v.push_back(tmp);
	int jug = 0;
	for (const auto& e : v)
	{
		if (jug) cout << ',';
		jug = 1;
		cout << e;
	}	cout << endl;
	cout << endl;
	Purge_Sq_OL(v);
	jug = 0;
	for (const auto& e : v)
	{
		if (jug) cout << ',';
		jug = 1;
		cout << e;
	}
}

int main()
{
	int t; cin >> t;
	if (t < 0 || t > 3) cout << "err";
	else if (t == 0)
		_Purge_Sq_OL(int());
	else if (t == 1)
		_Purge_Sq_OL(double());
	else if (t == 2)
		_Purge_Sq_OL(char());
	else if (t == 3)
		_Purge_Sq_OL(string());
	return 0;
}